/*
 * 
 *
 * Authors: Soeren Gebbert, soeren.gebbert@vti.bund.de
 *          Axel Don, axel.don@vti.bund.de
 *
 * Copyright:
 *
 * Johann Heinrich von Thünen-Institut
 * Institut für Agrarrelevante Klimaforschung
 *
 * Phone: +49 (0)531 596 2601
 *
 * Fax:+49 (0)531 596 2699
 *
 * Mail: ak@vti.bund.de
 *
 * Bundesallee 50
 * 38116 Braunschweig
 * Germany
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef MICR_CLUSTER_H
#define MICR_CLUSTER_H

#include <stdlib.h>
#include <math.h>
#include <stdio.h>

#include "particle_base.h"
#include "carb_particle.h"

/* A single micro-organism cluster */
class micr_cluster : public particle_base {
public:
    micr_cluster();
    micr_cluster(initial_parameters *init_params);
    micr_cluster(float x, float y, float z, float mass, initial_parameters *init_params);

    /* Respiration of the micro organism */
    void respirate();
    /* Growing carbon mass [g] of the microorganism  cluster */
    void eat(float mass);
    /** Get radius 
     * 
     * Compute the radius of the microorganism cluster sphere, 
     * based on mass and porosity
     * 
     */
    float get_radius();
    /**
     * Check if the particle is in the radius of the micro-organism cluster 
     * @param cp
     * @param radius
     */
    bool is_particle_in_radius(carb_particle *cp, float radius);
    /** Move the micro-organism randomly
     *
     * Using width and depth the boundary conditions are
     * automatically computed. Left and right side are swapping boundary conditions.
     * The top border is a reflection condition, the bottom border is a sink.
     * */
    void move();

    /** 
     * Return the current mass of the micro-organism cluster 
     */
    float get_mass() {
        return this->mass;
    }

    /** 
     * Set the micro-organism mass 
     * @params mass
     */
    void set_mass(float mass) {
        this->mass = mass;
    }

    /** 
     * Return the number for contacts with carbon particles 
     */
    int get_contacts() {
        return this->contacts;
    }

    /**
     * Set the number of contacts
     * @param contacts
     */
    void set_contacts(unsigned long contacts) {
        this->contacts = contacts;
    }
protected:
    float mass;
    unsigned long contacts;
};
#endif